home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Essentials / Developer Essentials May91 / MPW Interfaces & Libraries 3.2 / AIncludes / FixMath.a < prev    next >
Encoding:
Text File  |  1991-04-17  |  2.9 KB  |  86 lines  |  [TEXT/MPS ]

  1. ; Version: 2.94
  2. ; Created: Friday, October 20, 1989 at 9:16:04 PM
  3.  
  4. ; File: FixMath.a
  5. ;
  6. ; Copyright Apple Computer, Inc. 1984-1990
  7. ; All Rights Reserved
  8. ;
  9.  
  10.  
  11. ; These calls support three types of fixed point numbers, each 32 bits long.
  12. ; The bits are interpreted as shown. The '-' represents the sign bit.
  13. ;
  14. ; Type <---------Integer Portion--------> <-------Fractional Portion------>
  15. ;LongInt -xxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx.
  16. ;Fixed -xxxxxxx xxxxxxxx.xxxxxxxx xxxxxxxx
  17. ;Fract -x.xxxxxxxx xxxxxxxx xxxxxxxx xxxxxx
  18. ;
  19. ; Type LongInt can represent integers between +/-2147483647. Type Fixed can
  20. ; represent fractional quantities between +/-32768, with about 5 digits of
  21. ; accuracy. Type Fract can represent fractional quantities between +/-2 with
  22. ; about 9 digits of accuracy. These numeric representations are useful for
  23. ; applications that do not require the accuracy of the floating point routines,
  24. ; and which need to run as fast as possible. The Graf3D three dimensional
  25. ; graphics package resides on top of these routines. Although FixMul is in the
  26. ; file ToolTraps, it is shown below to show how it handles different types.
  27. ; Additional fixed point routines are described in the Inside Macintosh chapter,
  28. ; “Toolbox Utilities.”
  29.  
  30. ; FUNCTION FixMul(x, y: Fixed): Fixed;
  31. ; FixMul returns x * y. Note that FixMul effects "type * Fixed --> type":
  32. ; Fixed * Fixed --> Fixed
  33. ; LONGINT * Fixed --> LONGINT
  34. ; Fixed * LONGINT --> LONGINT
  35. ; Fract * Fixed --> Fract
  36. ; Fixed * Fract --> Fract
  37.  
  38. ; FUNCTION FracMul(x, y: Fract): Fract;
  39. ; FracMul returns x * y. Note that FracMul effects "type * Fract --> type":
  40. ; Fract * Fract --> Fract
  41. ; LONGINT * Fract --> LONGINT
  42. ; Fract * LONGINT --> LONGINT
  43. ; Fixed * Fract --> Fixed
  44. ; Fract * Fixed --> Fixed
  45.  
  46. ; FUNCTION FixDiv(x, y: Fixed): Fixed;
  47. ; FixDiv returns x / y. Note that FixDiv effects "type / type --> Fixed":
  48. ; Fixed / Fixed --> Fixed
  49. ; LONGINT / LONGINT --> Fixed
  50. ; Fract / Fract --> Fixed
  51. ; LONGINT / Fixed --> LONGINT
  52. ; Fract / Fixed --> Fract
  53.  
  54. ; FUNCTION FracDiv(x, y: Fract): Fract;
  55. ; FracDiv returns x / y. Note that FracDiv effects "type / type --> Fract":
  56. ; Fract / Fract --> Fract
  57. ; LONGINT / LONGINT --> Fract
  58. ; Fixed / Fixed --> Fract
  59. ; LONGINT / Fract --> LONGINT
  60. ; Fixed / Fract --> Fixed
  61.  
  62. ; FUNCTION FracSqrt(x: Fract): Fract;
  63. ; FracSqrt returns the square root of x. Both argument and result are regarded
  64. ; as unsigned.
  65.  
  66. ; FUNCTION FracCos(x: Fixed): Fract;
  67. ; FUNCTION FracSin(x: Fixed): Fract;
  68. ; FracCos and FracSin return the cosine and sine, respectively, given the
  69. ; argument x in radians.
  70.  
  71. ;The following routines are accessed via the glue code
  72. ;which will call the trap on a 128K ROM machine
  73.  
  74.     IF &TYPE('__IncludingFixMath__') = 'UNDEFINED' THEN
  75. __IncludingFixMath__    SET    1
  76.  
  77.  
  78. _FracCos          OPWORD      $A847
  79. _FracSin          OPWORD      $A848
  80. _FracSqrt         OPWORD      $A849
  81. _FracMul          OPWORD      $A84A
  82. _FracDiv          OPWORD      $A84B
  83. _FixDiv           OPWORD      $A84D
  84.  
  85.  
  86.     ENDIF    ; ...already included